﻿<UserControl x:Class="NexTrackDesktop.Controls.Playlist"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:media="clr-namespace:NexTrackDesktop.Media"
             xmlns:vm="clr-namespace:NexTrackDesktop.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="220">
    <UserControl.Resources>
        <vm:PlaylistViewModel x:Key="TestData">
            <vm:PlaylistViewModel.Songs>
                <vm:SongViewModel>
                    <vm:SongViewModel.Song>
                        <media:Song Album="FISHIES" Artist="DETHKLOK" Title="MurmaidMurmaidMurmaidMurmaidMurmaidMurmaid" Length="00:25:15.0"
                                    AlbumArtSource="https://www.google.com/images/srpr/logo4w.png"/>
                    </vm:SongViewModel.Song>
                </vm:SongViewModel>
            </vm:PlaylistViewModel.Songs>
        </vm:PlaylistViewModel>
    </UserControl.Resources>
    
    <Grid>
        <ListBox d:DataContext="{StaticResource TestData}" ItemsSource="{Binding Path=Songs}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="2" HorizontalAlignment="Stretch">
                        <Border Height="48" Width="48" HorizontalAlignment="Left" VerticalAlignment="Top"
                                BorderBrush="Black" BorderThickness="1" CornerRadius="3" Style="{StaticResource AlbumArtStyle}" />
                        
                        <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Margin="55,2,34,2" FontSize="11"
                                   Text="{Binding Path=Song.Title}" />
                        <TextBlock VerticalAlignment="Top" HorizontalAlignment="Right" Margin="2,2" FontSize="11" Width="Auto"
                                   Text="{Binding Path=Song.Length, StringFormat={}{0:mm':'ss}}" />
                        <TextBlock VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="55,20,0,0"
                                   FontStyle="Italic" Foreground="#222" FontSize="9">
                            <TextBlock.ToolTip>
                                <TextBlock><Run Text="{Binding Path=Song.Album}"/> - <Run Text="{Binding Path=Song.Artist}"/></TextBlock>
                            </TextBlock.ToolTip>
                            <Run Text="{Binding Path=Song.Album}"/> - <Run Text="{Binding Path=Song.Artist}"/>
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
